
package com.joolun.cloud.mall.admin.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.joolun.cloud.common.core.constant.CacheConstants;
import com.joolun.cloud.mall.common.entity.ShopInfo;
import com.joolun.cloud.mall.admin.mapper.ShopInfoMapper;
import com.joolun.cloud.mall.admin.service.ShopInfoService;
import com.joolun.cloud.weixin.common.entity.WxApp;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
import org.springframework.stereotype.Service;

import java.io.Serializable;

/**
 * 店铺表
 *
 * @author www.joolun.com
 * @date 2020-05-15 13:35:18
 */
@Service
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService {

	@Override
	@Cacheable(value = CacheConstants.MALL_SHOP_INFO_CACHE, key = "#id", unless = "#result == null")
	public ShopInfo getById(Serializable id) {
		return baseMapper.selectById(id);
	}

	@Override
	@CacheEvict(value = CacheConstants.MALL_SHOP_INFO_CACHE, allEntries = true)
	public boolean updateById(ShopInfo entity) {
		baseMapper.updateById(entity);
		return Boolean.TRUE;
	}

	@Override
	@CacheEvict(value = CacheConstants.MALL_SHOP_INFO_CACHE, allEntries = true)
	public boolean removeById(Serializable id) {
		baseMapper.deleteById(id);
		return Boolean.TRUE;
	}
}
